<%@ page import="com.fhd.constant.Constants" %>
<%@ page import="com.fhd.pojo.Client" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.fhd.pojo.Recharge" %><%--
  Created by IntelliJ IDEA.
  User: 44252
  Date: 2025/3/27
  Time: 11:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>我的钱包</title>
</head>
<body>
<h1><%=((Client)request.getSession().getAttribute(Constants.CLIENT_SESSION)).getUserName()%>，您的钱包余额为：</h1>
<h2><%=((Client)request.getSession().getAttribute(Constants.CLIENT_SESSION)).getMoney()%></h2>
<br>
<%--回到客户主页--%>
<a href="<%=request.getContextPath()%>/jsp/clientFrame.jsp">返回</a>
<br>
<span>充值操作:</span>
<br>
<div>
    <form action="<%=request.getContextPath()%>/client.do" method="post">
        <span>请输入要充值的金额:</span>
        <input type="hidden" name="method" value="clientRecharge">
        <input type="submit" name="money" value="10">
        <input type="submit" name="money" value="20">
        <input type="submit" name="money" value="50">
        <input type="submit" name="money" value="100">
        <input type="submit" name="money" value="500">

    </form>
</div>

<h2>充值记录：</h2>
<%
    String message = (String)request.getSession().getAttribute(Constants.GET_SOMEONE_RECHARGE_MESSAGE);
    if (message != null) {
        // 没有充值记录捏
        out.write("<h4 style=\"color: red\">" + message + "</h4>");
        request.getSession().removeAttribute(Constants.GET_SOMEONE_RECHARGE_MESSAGE);
    } else {
        // 有充值记录，把其全部打出来
        Object object = request.getSession().getAttribute(Constants.SOMEONE_RECHARGE_SESSION);
        if (object != null) {
            ArrayList<Recharge> recharges = (ArrayList<Recharge>) object;
            for (Recharge recharge : recharges) {
                out.print("订单编号:"+recharge.getId() + "<br>");
                out.print("充值金额:"+recharge.getMoney() + "<br>");
                int situation = recharge.getSituation();
                if (situation == 1) {
                    out.write("状态:等待确认");
                } else if (situation == 2) {
                    out.write("状态:已通过");
                } else if (situation ==3) {
                    out.write("状态:被取消");
                }
                out.write("<br>");
                out.write("=======================");
                out.write("<br>");
            }
        } else {
            out.write("没有充值数据，请充值先噢<br>");
        }
    }
%>


</body>
</html>
